package server;

import java.io.FileWriter;
import java.io.PrintWriter;

import org.omg.CORBA.ORB;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;

public class ServerMain {

	public static void main(String[] args) {
		try {
			ORB orb = ORB.init(args, null);
			POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
			poa.the_POAManager().activate();
			Servant servant = new Servant();
			org.omg.CORBA.Object obj = poa.servant_to_reference(servant);;

			PrintWriter pw = new PrintWriter(new FileWriter("corbaaccess.txt"));
			pw.println(orb.object_to_string(obj));
			pw.close();
			orb.run();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
